Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

205
Vistas
Migration from webpack4 -> webpack5, bundled file will have a faulty url when it gets requested?

I'm currently working on a migration from webpack4 to webpack5. I have problems with the URL to the bundled JS (in my case client.js).

wrong url to client.js file

This request should be two different ones. Here is an image from how it was with webpack4: enter image description here

This is the entry for the client:


// ...

name: 'client',
target: 'web',
devtool: 'source-map',
entry: {
  client: ['@babel/polyfill', './src/client.js'],
},

// ...

This is the output:

// ...

output: {
  path: resolvePath(BUILD_DIR, 'public/assets'),
  publicPath: '/assets/',
  pathinfo: isVerbose,
  filename: isDebug ? '[name].js' : '[name].[chunkhash:8].js',
  chunkFilename: isDebug ? '[name].chunk.js' : '[name].[chunkhash:8].chunk.js',
},

// ...

I have also set organization.splitChunks.cacheGroups as follows:

optimization: {
  splitChunks: {
    cacheGroups: {
      commons: {
        chunks: 'initial',
        test: /[\\/]node_modules[\\/]/,
        name: 'vendors',
      },
    },
  },
},

Since I was not the person who initially did this config file it's kind of hard to debug, I'm shooting wild here. And the file is fairly large, I've just pasted the bits I believe are important. If you think the issue could be because of another configuration property, feel free to share.

Anyone know why this is happening and why this happens?

Thanks in advance!

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

@AKX (Migration from webpack4 -> webpack5, bundled file will have a faulty url when it gets requested?)

You certainly guided me to the problem here. After fixing this error I accidentally created a nested array in chunk-manifest.json. The content should be:

{
  "client": [
    "/assets/vendors.chunk.js",
    "/assets/client.js"
  ]
}

Instead I screwed up while converting the Set to an array (to be able to run filter on it) so the content was instead:

{
  "client": [
    [
      "/assets/vendors.chunk.js",
      "/assets/client.js"
    ]
  ]
}

The nested array resulted in this concatenation so the URL went with a comma instead as two different sources.

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda